package com.iotp.service.disease_name;

import com.iotp.dao.disease_name.DiseaseNameMapper;
import com.iotp.entity.disease_name.DiseaseName;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("diseaseNameService")
public class DiseaseNameServiceImpl implements DiseaseNameService {
    @Autowired
    private DiseaseNameMapper diseaseNameMapper;
    @Override
    public Long add(DiseaseName diseaseName) {
        this.diseaseNameMapper.insert(diseaseName);
        return diseaseName.getId();
    }

    @Override
    public void update(DiseaseName diseaseName) {
        this.diseaseNameMapper.updateByPrimaryKeySelective(diseaseName);
    }

    @Override
    public void delete(Long id) {
        this.diseaseNameMapper.deleteByPrimaryKey(id);
    }

    @Override
    public DiseaseName queryById(Long id) {
        return this.diseaseNameMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<DiseaseName> queryList(DiseaseName diseaseName) {
        return this.diseaseNameMapper.selectByCondition(diseaseName);
    }
}
